package com.haiya.factory.absfactory.farm;


import com.haiya.factory.absfactory.farm.factory.Farm;
import com.haiya.factory.absfactory.farm.factory.GmFarm;
import com.haiya.factory.absfactory.farm.factory.ZhFarm;
import com.haiya.factory.absfactory.farm.product.Animal;
import com.haiya.factory.absfactory.farm.product.Plant;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Client {
    public static void main(String[] args) throws IOException {
        BufferedReader strin = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("input animal type: ");
        String type = strin.readLine();

        Farm farm;
        if (type.equals("horse")) {
            // 这是光明农场的马
            farm = new GmFarm();
            Animal animal = farm.newAnimal();
            animal.show();
        } else if (type.equals("cattle")) {
            // 这是智慧农场的牛
            farm = new ZhFarm();
            Animal animal = farm.newAnimal();
            animal.show();
        } else if (type.equals("fruite")) {
            // 这是光明农场的水果
            farm = new GmFarm();
            Plant plant = farm.newPlant();
            plant.show();
        } else if (type.equals("vegetable")) {
            // 这是智慧农场的蔬菜
            farm = new ZhFarm();
            Plant plant = farm.newPlant();
            plant.show();
        }
    }
}